/**
 * 创建 <a> 标签下载文件流格式图片
 * @param file
 * @param fileName
 */
export const downloadFile = (file, fileName) => {
    const blob = new Blob([file]);
    const fileReader = new FileReader();
    fileReader.readAsDataURL(blob);
    fileReader.onload = (e) => {
        const a = document.createElement("a");
        a.download = fileName;
        a.href = e.target?.result;
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
    };
}
